#include "libLUI_in.h"

funcLUIDrawMouseCursor LUIDrawMouseCursor_NORMAL ;
void LUIDrawMouseCursor_NORMAL( struct LUIWindowsManager *windows_manager )
{
	struct RBGA	rbga_black = { 0x03 , 0x03 , 0x03 , 0 } ;
	struct RBGA	rbga_white = { 0xEE , 0xEE , 0xEE , 0 } ;
	int		i , j ;
	
	for( j = 0 ; j < 10 ; j++ )
	{
		DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x , windows_manager->cursor_y+j , & rbga_black );
		for( i = 1 ; i <= j ; i++ )
		{
			DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+i , windows_manager->cursor_y+j , & rbga_white );
		}
		DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+i , windows_manager->cursor_y+j , & rbga_black );
	}
	
	for( j = 0 ; j < 5 ; j++ )
	{
		DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x , windows_manager->cursor_y+10+j , & rbga_black );
		for( i = 1 ; i < 5-j ; i++ )
		{
			DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+i , windows_manager->cursor_y+10+j , & rbga_white );
		}
		DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+i , windows_manager->cursor_y+10+j , & rbga_black );
	}
	
	for( i = 5 ; i < 10 ; i++ )
	{
		DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+i , windows_manager->cursor_y+10 , & rbga_black );
	}
	
	return;
}

funcLUIDrawMouseCursor LUIDrawMouseCursor_HORIZONTAL_RESIZING ;
void LUIDrawMouseCursor_HORIZONTAL_RESIZING( struct LUIWindowsManager *windows_manager )
{
	struct RBGA	rbga_black = { 0x03 , 0x03 , 0x03 , 0 } ;
	struct RBGA	rbga_white = { 0xEE , 0xEE , 0xEE , 0 } ;
	
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-1 , windows_manager->cursor_y-10 , windows_manager->cursor_x-1 , windows_manager->cursor_y+10 , & rbga_black )
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x , windows_manager->cursor_y-10 , windows_manager->cursor_x , windows_manager->cursor_y+10 , & rbga_white )
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+1 , windows_manager->cursor_y-10 , windows_manager->cursor_x+1 , windows_manager->cursor_y+10 , & rbga_black )
	
	return;
}

funcLUIDrawMouseCursor LUIDrawMouseCursor_VERTICAL_RESIZING ;
void LUIDrawMouseCursor_VERTICAL_RESIZING( struct LUIWindowsManager *windows_manager )
{
	struct RBGA	rbga_black = { 0x03 , 0x03 , 0x03 , 0 } ;
	struct RBGA	rbga_white = { 0xEE , 0xEE , 0xEE , 0 } ;
	
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-10 , windows_manager->cursor_y-1 , windows_manager->cursor_x+10 , windows_manager->cursor_y-1 , & rbga_black )
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-10 , windows_manager->cursor_y , windows_manager->cursor_x+10 , windows_manager->cursor_y , & rbga_white )
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-10 , windows_manager->cursor_y+1 , windows_manager->cursor_x+10 , windows_manager->cursor_y+1 , & rbga_black )
	
	return;
}

funcLUIDrawMouseCursor LUIDrawMouseCursor_MOVING ;
void LUIDrawMouseCursor_MOVING( struct LUIWindowsManager *windows_manager )
{
	struct RBGA	rbga_black = { 0x03 , 0x03 , 0x03 , 0 } ;
	
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-9 , windows_manager->cursor_y-1 , & rbga_black );
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-9 , windows_manager->cursor_y+1 , & rbga_black );
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-10 , windows_manager->cursor_y , windows_manager->cursor_x+10 , windows_manager->cursor_y , & rbga_black )
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+9 , windows_manager->cursor_y-1 , & rbga_black );
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+9 , windows_manager->cursor_y+1 , & rbga_black );
	
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-1 , windows_manager->cursor_y-9 , & rbga_black );
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+1 , windows_manager->cursor_y-9 , & rbga_black );
	DRAW_LINE( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x , windows_manager->cursor_y-10 , windows_manager->cursor_x , windows_manager->cursor_y+10 , & rbga_black )
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x-1 , windows_manager->cursor_y+9 , & rbga_black );
	DRAW_POINT( windows_manager , windows_manager->screen_rect , windows_manager->cursor_x+1 , windows_manager->cursor_y+9 , & rbga_black );
	
	return;
}

int LUILoadAllMouseCursors( struct LUIWindowsManager *windows_manager , char *pathfilename )
{
	windows_manager->pfuncMouseCursor[LUIMOUSECURSOR_TYPE_NORMAL] = & LUIDrawMouseCursor_NORMAL ;
	windows_manager->pfuncMouseCursor[LUIMOUSECURSOR_TYPE_HORIZONTAL_RESIZING] = & LUIDrawMouseCursor_HORIZONTAL_RESIZING ;
	windows_manager->pfuncMouseCursor[LUIMOUSECURSOR_TYPE_VERTICAL_RESIZING] = & LUIDrawMouseCursor_VERTICAL_RESIZING ;
	windows_manager->pfuncMouseCursor[LUIMOUSECURSOR_TYPE_MOVING] = & LUIDrawMouseCursor_MOVING ;
	return 0;
}

int LUIGetMouseCursor( struct LUIWindowsManager *windows_manager )
{
	return windows_manager->current_mouse_cursor_type ;
}

void LUISetMouseCursor( struct LUIWindowsManager *windows_manager , int mouse_cursor_type )
{
	windows_manager->current_mouse_cursor_type = mouse_cursor_type ;
	windows_manager->pfuncCurrentMouseCursor = windows_manager->pfuncMouseCursor[mouse_cursor_type] ;
	return;
}
